package com.animal.entity;

import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Data
public class Pet {
    private static final Logger LOGGER = LoggerFactory.getLogger(Pet.class);
    //宠物
    public Pet(){}
    private String name;    //宠物名字
    private int age;    //宠物年龄

    public void setAge(int age){
        //如果setAge被调用，则打印日志
        LOGGER.info("Pet对象的setAge方法被调用！参数 age = {}",age);
        this.age = age;
    }

    //自我介绍
    public void introduce(){
        System.out.println("我的名字叫："+this.name+"，今年"+ this.age +"岁了");
    }
}

